<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    var user = {
        name: '小丽',
        age: 18,
        hobby: '打游戏',
    };

    function deleteProperties() {
        // 删除全部
        for (var key in user) {
            delete user[key];
        }
        var userKey = Object.keys(user)
        console.log(userKey);
    }
    deleteProperties();
    console.log(user);

</script>

</html>